package com.moyu.oasys.announcement.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.moyu.common.core.domain.BaseEntity;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

/**
 * @Author 赵彦博
 * @Date 2024/12/2 19:47
 */
@Data
@ToString
@EqualsAndHashCode
public class Announcement extends BaseEntity {

    /**
     * 主键ID
     */
    @NotNull(message = "ID不能为空")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * 标题
     */
    @NotBlank(message = "标题不能为空")
    @Length(min = 5, max = 50, message = "标题长度为 5 到 50 之间")
    private String title;
    /**
     * 内容
     */
    @NotBlank(message = "内容不能为空")
    @Length(min = 5, max = 2000, message = "内容长度为 5 到 2000 之间")
    private String content;

}
